/**
 *  @file application.h
 *
 *  @date 19-nov-2009
 *  @author Ives van der Flaas
 */

#ifndef APPLICATION_H_
#define APPLICATION_H_

#include "window.h"
#include "applicationSection.h"

namespace si
{
enum Section{ MENU, SPLASH, GAME, INTRO, LOST, HIGHSCORES };

/**
 * The application that encompasses ALL. This class is abstract
 * and will be implemented as an SDLApplication.
 */
class Application
{
public:
	/**
	 * Constructor
	 * @param win The window the app will run in
	 * @return
	 */
	Application(Window* win);
	virtual ~Application(){}
	virtual void loop()=0;
	void changeSectionTo(Section sec);

	/**
	 * Needs to be called by the game engine as soon as the player loses, so we can check if
	 * he has higscore-worthy results.
	 * @param score The score the player achieved in this game
	 */
	void gameEnded(int score);


	/**
	 * Returns TRUE only THE FIRST TIME this function is called after the game
	 * has ended either through a lose or a win.
	 * @return
	 */
	bool didTheGameEnd();

	/**
	 * Returns the score the player achieved during the last playing of the game
	 * @return
	 */
	int getLastScore() const { return fLastScore; }

protected:
	/**
	 * The window this application will be viewed in.
	 */
	Window* fWindow;

	/**
	 * The current applicationSection we are in.
	 */
	ApplicationSection* fCurrentAppSection;

	ApplicationSection* fSplashSection;
	ApplicationSection* fIntroSection;
	ApplicationSection* fMenuSection;
	ApplicationSection* fGameSection;
	ApplicationSection* fLostSection;
	ApplicationSection* fHighScoresSection;

	bool fGameEnded;
	int fLastScore;

private:



};

}

#endif /* APPLICATION_H_ */
